#include <fstream>
#include <iostream>
#include <string>

#define LOCAL_DEBUG 0

#if LOCAL_DEBUG
char input_file[] = "data.in";
#define INPUT in
#else
#define INPUT cin
#endif // LOCAL_DEBUG

using namespace std;

///////////////////////////////////////////////////////////
// Sample Input Data:
// ABBA
// 12ABBA
// A
// ABAKK
// 51233214
// abaaab
///////////////////////////////////////////////////////////

bool substr_is_symmetric(string& code_in, unsigned int start_index, unsigned int end_index)
{
    bool ret = true;
    
    while(start_index < end_index)
    {
        if (code_in[start_index++] != code_in[end_index--])
        {
            ret = false;
            break;
        }   
    }
    
    return ret;
}

unsigned int max_sym_code_length(string& code_in)
{
    unsigned int code_length    = code_in.length();
    unsigned int start_index    = 0;
    unsigned int max_length     = (code_length == 0)?0:1;
    
    while(start_index < code_length)
    {
        unsigned int end_index = code_length - 1;
        
        while(start_index < end_index)
        {
            if (substr_is_symmetric(code_in, start_index, end_index))
            {
                if (max_length < (end_index - start_index + 1))
                    max_length = end_index - start_index + 1;
                    
                break;
            }

            end_index--;
        }
        
        start_index++;
    }
    
    return max_length;
}

int main(void)
{
    string code_in;
    
#if LOCAL_DEBUG
    ifstream in(input_file);
#endif // LOCAL_DEBUG

    while(INPUT.good())
    {
        getline(INPUT, code_in);
        if (code_in.size() > 0)
        {
            cout<<max_sym_code_length(code_in)<<endl;
        }
    }

    return 0;
}
